package com.wyx.pojo.templateConfig;

import com.wyx.utils.commonUtil.FileUtil;
import com.wyx.utils.commonUtil.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.io.File;
import java.util.List;

@Component
public class SmokeAnticipatedOrder {
    @Value("${wy.template.smokeAnticipatedOrder.path}")
    private String basePath;
    @Value("${wy.template.smokeAnticipatedOrder.t1.fileName}")
    private String fileName;
    @Value("${wy.template.smokeAnticipatedOrder.t1.lineColorS}")
    private String lineColorsStr;
    @Value("${wy.template.smokeAnticipatedOrder.t1.enhanceColorGearLv}")
    private String enhanceColorGearLvStr;
    @Value("${wy.template.smokeAnticipatedOrder.t1.preGearLvColumnNum}")
    private String preGearLvColumnNum;
    @Value("${wy.template.smokeAnticipatedOrder.t1.enhanceColor}")
    private String enhanceColor;
    @Value("${wy.template.smokeAnticipatedOrder.t1.listInterval}")
    private String listInterval;
    @Value("${wy.template.smokeAnticipatedOrder.t1.orderDetailGears}")
    private String orderDetailGearStr;
    @Value("${wy.template.smokeAnticipatedOrder.t1.remarkFileName}")
    private String remarkFilePath;

    private int[] lineColorS;
    private byte[] templateFileByte;
    private int[] enhanceColorGearLvS;
    private int[] listIntervalS;
    private int[] orderDetailGearS;
    private List<String> remarkList;

    @PostConstruct
    public void init() {
        this.enhanceColorGearLvS = StringUtils.conversionStrToArray(enhanceColorGearLvStr, " ");
        this.lineColorS = StringUtils.conversionStrToArray(lineColorsStr);
        this.templateFileByte = FileUtil.getResourceFileByte(basePath + fileName);
        this.listIntervalS = StringUtils.conversionStrToArray(listInterval, ",");
        this.orderDetailGearS = StringUtils.conversionStrToArray(orderDetailGearStr, ",");
        this.remarkList = FileUtil.getResourceFileToStrList(remarkFilePath);
    }

    public int[] getListIntervalS() {
        return listIntervalS;
    }

    public String getEnhanceColor() {
        return enhanceColor;
    }

    public int[] getLineColorS() {
        return lineColorS;
    }

    public String getPreGearLvColumnNum() {
        return preGearLvColumnNum;
    }

    public int[] getEnhanceColorGearLvS() {
        return enhanceColorGearLvS;
    }

    public String getFileName() {
        return fileName;
    }

    public byte[] getTemplateFileByte() {
        return templateFileByte;
    }

    public int[] getOrderDetailGearS() {
        return orderDetailGearS;
    }

    public List<String> getRemarkList() {
        return remarkList;
    }
}
